Skip to content

Performance benchmark#6

Merged
gsvgit merged 28 commits intoSparseLinearAlgebra:devfrom
dpanfilyonok:simple-bfs-benchmark
Dec 8, 2020
Merged

Performance benchmark#6
gsvgit merged 28 commits intoSparseLinearAlgebra:devfrom
dpanfilyonok:simple-bfs-benchmark

Conversation

@dpanfilyonok
Copy link
Copy Markdown
Collaborator

@dpanfilyonok dpanfilyonok commented Dec 8, 2020

Proposed Changes

  1. Changed some method signatures to match specification.
  2. Added project for performance benchmarking.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Build and tests pass locally
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

let (nrows, ncols, nnz) = float matrixInfo.[0], float matrixInfo.[1], float matrixInfo.[2]
let (vertices, edges) = if nrows = ncols then (nrows, nnz) else (ncols, nrows)
sprintf "%f" (edges / meanTime)
| _ -> "file`s format not supported"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to add the current file format to the message. Also, it may be useful to add supported formats.

Comment thread src/GraphBLAS-sharp/Abstracts.fs Outdated
abstract Fill: Mask1D option * int -> Scalar<'a> with set
abstract Fill: int * Mask1D option -> Scalar<'a> with set

abstract Mxm: Matrix<'b> -> Mask2D option -> Semiring<'a, 'b, 'c> -> Matrix<'c>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... What the reason to add two new type parameters to semiring?

Comment thread src/GraphBLAS-sharp/Abstracts.fs Outdated

abstract Mxm: Matrix<'b> -> Mask2D option -> Semiring<'a, 'b, 'c> -> Matrix<'c>
abstract Mxv: Vector<'b> -> Mask1D option -> Semiring<'a, 'b, 'c> -> Vector<'c>
abstract EWiseAdd: Matrix<'a> -> Mask2D option -> BinaryOp<'a, 'b, 'c> -> Matrix<'a>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why binary operation is not closed? Seems, we had discussed this point. I think semiring should have one type parameter and be closed. If it is really necessary, then one can use tuples of the required size as a domain.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is necessary because there is a parent BFS algorithm, which use non-closed minFirst semiring. The alternative, which use embedding, doesn't seem very intuitive to me. Now, I can make the semiring closed, but this problem will require a more elegant solution in the future.

Comment thread src/GraphBLAS-sharp/Abstracts.fs Outdated
abstract EWiseAdd: Vector<'a> -> Mask1D option -> Semiring<'a> -> Vector<'a>
abstract EWiseMult: Vector<'a> -> Mask1D option -> Semiring<'a> -> Vector<'a>
abstract Vxm: Matrix<'b> -> Mask1D option -> Semiring<'a, 'b, 'c> -> Vector<'c>
abstract EWiseAdd: Vector<'a> -> Mask1D option -> BinaryOp<'a, 'b, 'c> -> Vector<'a>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we should use monoid instead of binaryOp, because for sparse operations we need to know an ID. Thus, it may be useful to define semiring as an extension of monoids.

open GraphBLAS.FSharp

[<AutoOpen>]
module SSSP =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that SSSP should be defined using R^\infinite semiring. Or we assume that the distance between two nodes cannot be 0? If we use R as a domain, then distance can be equals to 0. Thus we should use R^\infinite or R+.


[<AutoOpen>]
module TriangleCounting =
// нужна проекция в инт
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean?

}

module BooleanSemiring =
let anyAll: Semiring<bool> = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh... I'm confused. Here we have semiring with one type parameter, but in some files, we use semiring with three type parameters.


module FloatSemiring =
let addMult: Semiring<float> = {
PlusMonoid = FloatMonoid.add
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm.... Semiring already uses Monoid in definition... Well...

Comment thread src/GraphBLAS-sharp/Semiring.fs Outdated
type Semiring<'a> = {
PlusMonoid: Monoid<'a>
Times: BinaryOp<'a, 'a, 'a>
type Semiring<'T1, 'T2, 'TOut> = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

open System

type VectorType =
| Sparse = 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why enums?

Copy link
Copy Markdown
Collaborator Author

@dpanfilyonok dpanfilyonok Dec 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because they are easier to enumerate. They could be enumerated without reflection.

@dpanfilyonok dpanfilyonok requested a review from gsvgit December 8, 2020 14:43
Copy link
Copy Markdown
Member

@gsvgit gsvgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good enough.

  1. I think, we should add SSSP over R\infinite semiring in addition to the existing one. Not now, but in the nearest future. It will be useful for DU translation evaluation. It should help to estimate an overhead.
  2. Build should be fixed.

@gsvgit gsvgit merged commit 0f7f9e1 into SparseLinearAlgebra:dev Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants